def findMods = {line->
    def oxi = ''
    def seqIndex = -1
    def brOpen = false
    line.eachWithIndex{letter,pos->
        if((letter!='_')&&(!brOpen)){
            if(letter=='('){
                brOpen=true
                if(line[pos..(pos+3)]=='(ox)'){
                    oxi = oxi+''+seqIndex+';'
                }
            }else{
                seqIndex++
            }
        }else if(letter==')'){brOpen=false}
    }
    return (oxi[0..-2])
}

println findMods('_(ac)012345M(ox)7890M(ox)GHJKDFGHJK')